<?php $this->placeholder('toolBar')->captureStart();?>
<input type="button" class="button" onclick="deleteSelected();" value="Удалить" />
<input class="button" type="submit" onclick="blockUI('Удаление...');$.post(url('order/edit/clear-all'), function(){reloadPage();});" name="clearAll" value="Очистить все"/>
<?php $this->placeholder('toolBar')->captureEnd() ?>

<script>
function getSelectIds()
{
	var ids = [];
	$(".ids").filter(':checked').each(function (){
			ids.push($(this).val());
		});

	return ids;
}

function deleteSelected()
{
	if ( !confirm('Удалить?') ) return;

	blockUI('Идет удаление...');
	
	var ids = getSelectIds();
	$.post(url('order/edit/remove'), {'ids':ids}, function(){ 
		unBlockUI();
		$(ids).each(function (key, value){
				$("#" + value ).parent().parent().fadeOut();
			});
		});
}
</script>

<?php 
if (!count($this->Rows))
{?>
<center><h3>Заказов нет</h3></center>  
<? 
}
else
{
    
?>

<table class="niceTable" style="width: 70%">
<tr>
<th width="5">#</th>
<th>Объект</th>
<th width="150">Дата создания</th>
<th width="150">Дата заезда</th>
<th width="150">Дата отъезда</th>
</tr>
<?php 
foreach ($this->Rows as $Item)
{
    $color = ($Item['status'])?"#8AFB17":"none";
?>	
<tr style="background-color: <?=$color?>" onmouseover="$(this).css('background-color','#6698FF')"  onmouseout="$(this).css('background','<?=$color?>')" >

<td><input type="checkbox" class="ids" name="ids[]" id="<?=$Item['ID'] ?>" value="<?=$Item['ID'] ?>"/>  </td>

<td><a href="<?=$this->baseUrl('order/edit/process/id/' . $Item['ID']) ?>"><?=$Item['Object']    ?></a></td>
<td><?=$Item['created']   ?></td>
<td><?=$Item['arrival']   ?></td>
<td><?=$Item['departure'] ?></td>



</tr>
<?php 
}
?>
</table>

<?php 
}
?>

<script>
function openOrder(id)
{
	window.location.href = url("order/edit/process/id/"+ id);
}
</script>